﻿using Pay.Core;
using Pay.Data;
using Pay.DTO;
using Pay.IService;
using Pay.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Pay.Token.Controllers {
    [AppAuthorize("Member")]
    public class NoticController : GeneralController {
      private IMessagePushService _iMessagePushService { get; set; }
        private INoticeService _noticeService;
        public NoticController( INoticeService noticeService, IMessagePushService iMessagePushService) {
                       _noticeService = noticeService;
            _iMessagePushService = iMessagePushService;
        }
        public ActionResult List() {
            return View();
        }
        public PartialViewResult _List(NoticeApiQuery query) {
            var list = _noticeService.GetAppNoticePageList(query, UserId);
            return PartialView(list);
        }
        public ActionResult Detail(long Id) {
            var notic=   _noticeService.AppGetNotice(Id, UserId);
            ViewData["notic"] = notic;
            return View();
        }
        /// <summary>
        /// 个人消息列表
        /// </summary>
        /// <returns></returns>
        public ActionResult MessageList() {
            return View();
        }
        public PartialViewResult _MessageList(MessageQuery query) {
            query.user_id = UserId;
            query.type = 0;
            var list = _iMessagePushService.Get(query);
            return PartialView(list);
        }
       /// <summary>
       /// 个人消息详情
       /// </summary>
       /// <param name="Id"></param>
       /// <returns></returns>
        public ActionResult MessageDetail(long Id) {
            var notic = _iMessagePushService.Get(Id);
            ViewData["notic"] = notic;
            return View();
        }
        /// <summary>
        /// 消息公告首页
        /// </summary>
        /// <returns></returns>
        public ActionResult NoticeMessge() {
            var model = _noticeService.GetNoticMessage(UserId);
            return View(model);
        }
    }
}
